#ifndef __MARS_GRAPHICS_MATERIALMGR_H__
#define __MARS_GRAPHICS_MATERIALMGR_H__

#include "MarsType.h"
#include "MarsObject.h"
#include "MarsSingleton.h"

using namespace Core;

namespace Graphics
{

class Material;

class MaterialMgr : public Object, public Singleton< MaterialMgr >
{
public:
	bool							Initialize();
	void							Shutdown();

	Material&						CreateMaterial( const std::string& name );
	Material&						CopyMaterial( const Material& mat, const std::string& name );
	const Material&					LoadMaterial( const std::string& filename, const std::string& name );
	const Material&					GetMaterial( const std::string& name );

private:
	typedef std::map< std::string, Material* >	MaterialMap;
	typedef MaterialMap::iterator				MaterialMapItr;
	typedef MaterialMap::const_iterator			MaterialMapConstItr;

private:
									MaterialMgr();
									~MaterialMgr();

									MARS_NO_INIT_ASSIGNMENT( MaterialMgr );

	int								m_iMaterialSerialId;
	MaterialMap						m_mapMaterials;

	friend class Singleton< MaterialMgr >;
};

} // end of namespace Graphics

#endif // end of #ifndef __MARS_GRAPHICS_MATERIALMGR_H__